<?php
/* 
* @Author: Jerry-chen
* @Date:   2014-07-06 18:11:23
* @Last Modified time: 2014-07-23 17:05:14
* @Last Modified by: Jerry-chen<uranusbill@163.com>
* @ Copyright (c) 2014 http://www.cooldreamer.com All rightsreserved.
*/

class LoginControl extends Control
{
	/**登陆页
	 * [index description]
	 * @return [type] [description]
	 */
	public function index()
	{
		if(IS_POST)
		{
			// p(Q('post.'));die;
			$MemberModel = K('Admin');
			//验证登陆
			$MemberData = $MemberModel->validate_login();
			if(!$MemberData)
			{
				$this->error($MemberModel->error,U('index'),20);

			}
			session('username',$MemberData['username']);
			session('aid',$MemberData['aid']);
			$this->success('登陆成功',U('Index/index'));
		}

	$this->display();
	}
	
	/**验证码
	 * [code description]
	 * @return [type] [description]
	 */
	public function code()
	{
		//实例化CODE类
		$code = new Code();
		//执行SHOW方法
		$code->show();
	}
	/**
	 * [log_out 退出登陆]
	 * @return [type] [description]
	 */
	public function log_out()
	{
		session('username',null);
		session('adminid',null);
		$this->success('退出成功',U('Login/index'));
	}
}


?>
